package linkedlist;

import org.junit.Test;

import static linkedlist.ListNode.*;

public class PrintListReversely1265 {

    @Test
    public void test() {
        ListNode list1 = buildList(1, 2);
        printListReversely(list1);
    }

    public void printListReversely(ListNode head) {
        if (head == null) {
            return;
        }

        printListReversely(head.next);
        System.out.print(" -> ");
        System.out.print(head.val);
    }
}
